<!DOCTYPE html>
<html>
<!-- Mirrored from www.zi-han.net/theme/hplus/table_data_tables.html by HTTrack Website Copier/3.x [XR&CO'2014], Wed, 20 Jan 2016 14:20:01 GMT -->

<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>车辆列表</title>
    <link rel="shortcut icon" href="favicon.ico">
    <link href="__PUBLIC__/dist/css/bootstrap.min14ed.css?v=3.3.6" rel="stylesheet">
    <link href="__PUBLIC__/dist/css/font-awesome.min93e3.css?v=4.4.0" rel="stylesheet">
    <link href="__PUBLIC__/dist/css/plugins/iCheck/custom.css" rel="stylesheet">
    <link href="__PUBLIC__/dist/css/animate.min.css" rel="stylesheet">
    <link href="__PUBLIC__/dist/css/style.min862f.css?v=4.1.0" rel="stylesheet">
</head>

<body class="gray-bg">
    <div class="wrapper wrapper-content animated fadeInRight">
        <div class="row">
            <div class="col-sm-12">
                <div class="ibox float-e-margins">
                    <div class="ibox-title">
                        <h5>车辆列表</h5>
                    </div>
                    <div class="ibox-content">
                        <div class="row">
                            <div class="col-sm-1 m-b-xs">
                                <a href="{:Url('Cars/info')}" class="btn btn-primary">增加</a>
                            </div>
                            <form method="get">
                                <div class="col-sm-2 m-b-xs">
                                    <select class="form-control" name="state">
                                        <option value="0">状态</option>
                                        {foreach name="states" item="value"}
                                        <option value="{$value.id}" {if condition="$state!=null && $value.id == $state"}selected{/if}>{$value.config_name}</option>
                                        {/foreach}
                                    </select>
                                </div>
                                <div class="col-sm-2 m-b-xs">
                                    <select class="form-control" name="car_mode_name">
                                        <option value="">型号</option>
                                        {foreach name="car_modes" item="value"}
                                        <option value="{$value.config_name}" {if condition="$car_mode_name!=null && $value.config_name == $car_mode_name"}selected{/if}>{$value.config_name}</option>
                                        {/foreach}
                                    </select>
                                </div>
                                <div class="col-sm-2 m-b-xs">
                                    <select class="form-control" name="hire_mode">
                                        <option value="">租赁类型</option>
                                        {foreach name="hire_modes" item="value"}
                                        <option value="{$value.id}" {if condition="$hire_mode!=null && $value.id == $hire_mode"}selected{/if}>{$value.config_name}</option>
                                        {/foreach}
                                    </select>
                                </div>
                                <div class="col-sm-2 m-b-xs">
                                    <select class="form-control" name="store_id">
                                        <option value="">车辆用途</option>
                                        {foreach name="purposes" item="value"}
                                        <option value="{$value.id}" {if condition="$purpose_id!=null && $value.id == $purpose_id"}selected{/if}>{$value.config_name}</option>
                                        {/foreach}
                                    </select>
                                </div>
                                <div class="col-sm-2 m-b-xs">
                                    <select class="form-control" name="store_id">
                                        <option value="">所属门店</option>
                                        {foreach name="stores" item="value"}
                                        <option value="{$value.id}" {if condition="$store_id!=null && $value.id == $store_id"}selected{/if}>{$value.name}</option>
                                        {/foreach}
                                    </select>
                                </div>
                                <div class="col-sm-2 m-b-xs">
                                    <input type="text" placeholder="关键字" value="{$purpose}" name="purpose" class="form-control">
                                </div>
                                <div class="col-sm-1 m-b-xs">
                                    <input type="submit" class="btn btn-primary" value="搜索" />
                                </div>
                                <div class="col-sm-1 m-b-xs">
                                    <input type="button" id="betch_del" class="btn btn-primary betch_del hidden-xs" value="批量删除" />
                                </div>
                                <div class="col-sm-1 m-b-xs">
                                    <input type="button" onclick="GetUploadify3(10,'','xls,xlsx','import_excel','call_back');" class="btn btn-primary" value="导入" />
                                </div>
                            </form>
                        </div>
                        <table class="table table-bordered text-center">
                            <thead>
                                <tr>
                                    <th class="hidden-xs">选择</th>
                                    <th class="hidden-xs">ID</th>
                                    <th class="hidden-xs">车辆型号</th>
                                    <th>车牌号</th>
                                    <th class="hidden-xs">供应商简称</th>
                                    <th class="hidden-xs">所属网点</th>
                                    <th class="hidden-xs">当前状态</th>
                                    <th class="hidden-xs">用途</th>
                                    <th class="hidden-xs">租赁类型</th>
                                    <th class="hidden-xs">年审日期</th>
                                    <th class="hidden-xs">起租日期</th>
                                    <th class="hidden-xs">终止日期</th>
                                    <th class="hidden-xs">下次续费日期</th>
                                    <th>操作</th>
                                </tr>
                            </thead>
                            <tbody>
                                {foreach name="list" item="item"}
                                <tr> 
                                    <td class="hidden-xs">
                                        <input class="i-checks" type="checkbox" value="{$item.id}" name="car_id">
                                    </td>
                                    <td class="hidden-xs">
                                        <input type="hidden" name="cars_id" value="{$item.id}" />
                                        {$item.id}
                                    </td>
                                    <td class="hidden-xs">{$item.car_mode_name}</td>
                                    <td>{$item.plate_no}</td>
                                    <td class="hidden-xs">{$item.supplier_name}</td>
                                    <td class="hidden-xs">{$item.store_name}</td>
                                    <td class="hidden-xs">{$item.state_name}</td>
                                    <td class="hidden-xs">{$item.purpose_name}</td>
                                    <td class="hidden-xs">{$item.hire_mode_name}</td>
                                    <td class="hidden-xs">
                                        {if condition="!empty($item.trial_date) && strlen($item.trial_date)>0 && $item.trial_date>0"}
                                        {$item.trial_date|date="Y年m月d日",###}
                                        {/if}
                                    </td>
                                    <td class="hidden-xs">
                                        {if condition="!empty($item.start_hiretime) && strlen($item.start_hiretime)>0 && $item.start_hiretime>0"}
                                        {$item.start_hiretime|date="Y年m月d日",###}
                                        {/if}
                                    </td>
                                    <td class="hidden-xs">
                                        {if condition="!empty($item.end_hiretime) && strlen($item.end_hiretime)>0 && $item.end_hiretime>0"}
                                        {$item.end_hiretime|date="Y年m月d日",###}
                                        {/if}
                                    </td>
                                    <td class="hidden-xs">
                                        {if condition="!empty($item.next_paytime) && strlen($item.next_paytime)>0 && $item.next_paytime>0"}
                                        {$item.next_paytime|date="Y年m月d日",###}
                                        {/if}
                                    </td>
                                    <td>
                                        <a href="{:Url('Cars/info',['id'=>$item['id']])}" class="btn btn-warning btn-xs">编辑</a>
                                        <a href="{:Url('Cars/del',['id'=>$item['id']])}" class="btn btn-danger btn-xs"
                                            onclick="return confirm('确认删除？');">删除</a>
                                    </td>
                                </tr>
                                {/foreach}
                            </tbody>
                        </table>
                        <div class="row page">
                            <div class="col-sm-12 text-center">
                                {$page}
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
    <script src="__PUBLIC__/dist/js/jquery.min.js?v=2.1.4"></script>
    <script src="__PUBLIC__/dist/js/bootstrap.min.js?v=3.3.6"></script>
    <script src="__PUBLIC__/dist/js/plugins/peity/jquery.peity.min.js"></script>
    <script src="__PUBLIC__/dist/js/content.min.js?v=1.0.0"></script>
    <script src="__PUBLIC__/dist/js/plugins/iCheck/icheck.min.js"></script>
    <script src="__PUBLIC__/dist/js/demo/peity-demo.min.js"></script>
    <script src="__PUBLIC__/dist/js/plugins/layer/layer.min.js"></script>
    <script type="text/javascript" charset="utf-8" src="__PUBLIC__/libs/global.js?rnd=12345678"> </script>
    <script type="text/javascript">
        $(document).ready(function () { $(".i-checks").iCheck({ checkboxClass: "icheckbox_square-green", radioClass: "iradio_square-green", }) });
        function call_back(paths) {
            var index = parent.layer.load(1, {
                shade: [0.3,'#000'] //0.1透明度的白色背景
            });
            if(paths && paths.length>0){
                $.ajax({
                    type: 'POST',
                    url: "{:Url('Cars/import_data')}",
                    data: { file_url: paths },
                    dataType: 'json',
                    success: function (res) {
                        parent.layer.close(index);
                        if(parseInt(res['status'])>0){
                            alert(res['msg']);
                            window.location = window.location.href.replace('#','');
                        }else{
                            alert(res['msg']);
                        }
                    }
                });
            }else{
                parent.layer.close(index);
                alert('请选择导入数据文件');    
            }
        } 
        $('#betch_del').click(function(){
            var car_ids = '';
            
            $('input[name=car_id]:checked').each(function(){
                var car_id = $(this).val();
                car_ids += car_ids.length>0?',':'';
                car_ids += car_id;
            });
            if(car_ids.length>0){
                if(confirm('确定删除车辆?')){
                    $.ajax({
                        type: 'POST',
                        url: "{:Url('Cars/betch_del')}",
                        data: { car_ids: car_ids },
                        dataType: 'json',
                        success: function (res) {
                            if(parseInt(res['status'])>0){
                                alert(res['msg']);
                                window.location = window.location.href.replace('#','');
                            }else{
                                alert(res['msg']);
                            }
                        }
                    });
                }
            }else{
                alert('请选择要删除的车辆');
            }
        });
    </script>
</body>


<!-- Mirrored from www.zi-han.net/theme/hplus/table_data_tables.html by HTTrack Website Copier/3.x [XR&CO'2014], Wed, 20 Jan 2016 14:20:02 GMT -->

</html>